package br.com.insight.consultoria.integracao.dao;

import org.springframework.dao.DataAccessException;

import br.com.insight.consultoria.entity.Area;
import br.com.insight.consultoria.erro.exception.InsightConstants;
import br.com.insight.consultoria.erro.exception.InsightDaoException;
import br.com.insight.consultoria.erro.exception.InsightException;
import br.com.insight.consultoria.erro.exception.SistemaException;
import br.com.insight.consultoria.integracao.dao.genericdao.GenericDAO;
import br.com.insight.consultoria.integracao.dao.interfacedao.AreaDAO;

public class AreaImpDAO extends GenericDAO implements AreaDAO {

	@Override
	public Area getArea(Long id) throws InsightException {
		
		Area area=null;
		
		try{

			area=(Area) getEntityById(Area.class, id);
			
		}catch(DataAccessException sql){
			
			throw new InsightDaoException(InsightConstants.MENSAGEM_ERRO_ACESSO_BANCO,sql);
		
		}catch(Exception ex){
			
			throw new SistemaException(InsightConstants.MENSAGEM_ERRO_NAO_TRATADO,ex);
			
		}

		return area;
	}
	
}
